<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<title>elementUI级联菜单演示</title>
</head>
<body>
<div id="app">
	<el-cascader :options="options"></el-cascader>
</div>
<script>
	let data=[
		'中国,湖南,株洲,荷塘区,大学',
		// '中国,湖南,株洲,石峰区,社会大学'
	];
	let newData=data[0].split(',');
	// console.log(newData);
	//数组转换为对象
	newData=newData.map(o=>({value:o,label:o,children:[]}));
	newData.reverse().forEach((o,i,arr)=>{
		i<arr.length-1 ? arr[i+1].children.push(o):null
		
	})
	console.log(newData[4]);

	
	
let app=new Vue({
	el:"#app",
	data:{
		options:[newData[4]]
		
	},
		
});
</script>
</body>
<html>
